package c.c.a;

import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import androidx.appcompat.view.menu.ListMenuItemView;

public class g0 {
    public static View a(View view, MenuItem menuItem) {
        MenuItem invoke;
        int i = 0;
        if (view.getClass() == i0.e) {
            invoke = i0.f.invoke(view, new Object[0]);
        } else {
            Object obj = 1;
            Object obj2 = (e0.n && (view instanceof ListMenuItemView)) ? 1 : null;
            if (obj2 != null) {
                invoke = ((ListMenuItemView) view).getItemData();
            } else {
                if (!(e0.i && (view instanceof ListMenuItemView))) {
                    obj = null;
                }
                invoke = obj != null ? ((ListMenuItemView) view).getItemData() : null;
            }
        }
        if (invoke == menuItem) {
            return view;
        }
        if (view instanceof ViewGroup) {
            while (true) {
                ViewGroup viewGroup = (ViewGroup) view;
                if (i >= viewGroup.getChildCount()) {
                    break;
                }
                View a = a(viewGroup.getChildAt(i), menuItem);
                if (a != null) {
                    return a;
                }
                i++;
            }
        }
        return null;
    }
}
